<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Layui</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/layui/css/layui.css" media="all">
<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
	<form class="layui-form layui-form-pane" action="">

		<div class="layui-form-item">
			
			<div class="layui-inline">
				<label class="layui-form-label">仓库名称</label>
				<div class="layui-input-inline">
					<input type="text" name="sooWarehouseName" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<button class="layui-btn" lay-submit="" lay-filter="query">查询</button>
			</div>
		</div>
	</form>
	<table class="layui-hide" id="test" lay-filter="test"></table>

	<!-- 新增和编辑的表单 -->
	<div id="edit-form-div"
		style="display: none; padding: 50px; background-color: white;">
		<form class="layui-form" id="edit-form" action="" lay-filter="edit-form">
			<input type="hidden" name="warehouseId" id="warehouseId" value="" />
				
				<div class="layui-form-item">
					<label class="layui-form-label">仓库名称</label>
					<div class="layui-input-block">
						<input type="text" class="layui-input" id="warehouseName"
							name="warehouseName" placeholder="XXX" lay-key="1">
					</div>
				</div>
				
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="submit" class="layui-btn" lay-submit=""
							lay-filter="save">保存</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
		</form>
	</div>
<script type="/text/html" id="toolbarDemo">
  <div class="layui-btn-container">
	<button class="layui-btn layui-btn-sm" lay-event="add">新增</button>
  </div>
</script>
<script type="text/html" id="switchTpl">
	<input type="checkbox" name="status" value="{{d.warehouseId}}" lay-skin="switch" lay-text="已启用|已停用" lay-filter="status" {{ d.status == 1 ? 'checked' : '' }}>
</script>
<script type="/text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> 
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script src="/layui/layui.js" charset="utf-8"></script>
<script src="/modules/warehouse.js" charset="utf-8"></script>
<script src="/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
	$(function(){
		var $sioWarehouseId=$('#sioWarehouseId');
		var $goodsId=$('#goodsId');
		var str;
		$.get("/warehouse/show",function (result) {
			$(result.data).each(function(index,element){
            	str="<option value='"+element.warehouseId+"'>"+element.warehouseName+"</option>"
            	$sioWarehouseId.append(str);
			})
	     });
	        
	      $.get('/goods/show', function (result) {
	    	  
	    	  $(result.data).each(function(index,element){
	            	str="<option value='"+element.goodsId+"'>"+element.goodsName+"</option>"
	            	$goodsId.append(str);
				})
	 });
	});


</script>



</body>
</html>